import time

from selenium.webdriver.common.by import By

from autoframe.common.base import Base

login_url = 'http://139.129.26.163/admin/privilege.php?act=login'


class LoginPage(Base):
    login_url = 'http://139.129.26.163/admin/privilege.php?act=login'

    def input_username(self, username='admin'):
        self.find_element((By.NAME, "username")).send_keys(username)

    def input_password(self, password='admin123 '):
        self.find_element(("name", "password")).send_keys(password)

    def login(self):
        self.click((By.CLASS_NAME, "btn-a"))

    def order_login(self):
        self.click((By.XPATH, '//*[@id="menu-ul"]/li[4]'))

    def username(self):
        return self.get_element_text((By.ID, 'foot-div'))

    def login_frame(self):
        self.frame((By.ID, 'menu-frame'))




if __name__ == '__main__':
    login = LoginPage("chrome")
    login.get("https://ecshop.test2.shopex123.com/user.php")
    time.sleep(2)
    login.input_username("fine1")
    login.input_password("123456")
    login.login()
    login.quit(2)
